<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    省份：<input type="text" name="" id="province"><br>
    <button>点击查找城市</button>
    <ul>
        <li>长沙市</li>
    </ul>
    <script src="./js/axios.min.js"></script>
    <script>
        document.querySelector('button').addEventListener('click',function(){
            let province = document.querySelector('#province').value.trim()
            axios({
                // url:'http://http://hmajax.itheima.net/api/city?pname=${province}'
                url:'http://hmajax.itheima.net/api/city',
                params:{
                    pname:province
                }
            }).then(res => {
                console.log(res);
                document.querySelector('ul').innerHTML =
                res.data.list.map(item => `<li>${item}</li>`).join('')
            })
        })
    </script>
</body>
</html>